/*
 * File:   ListOfTask.cpp
 * Author: switch
 *
 * Created on 22 janvier 2013, 21:33
 */

#include "ListOfTask.h"

ListOfTask::ListOfTask(string name_ , Date date_ ) : name(name_),date(date_) {}
ListOfTask::ListOfTask(string name_ ) : name(name_) {}

ListOfTask::~ListOfTask() {
}


void ListOfTask::setName(string name) {
    this->name = name;
}

string ListOfTask::getName() const {
    return name;
}

void ListOfTask::setDate(Date date) {
    this->date = date;
}

Date ListOfTask::getDate() const {
    return date;
}

//Gestion de la liste des taches
void ListOfTask::addTask(Task* t) {
    tasksList.push_back(t);
}

void ListOfTask::removeTask(Task* t) {
    tasksList.remove(t);
}

list<Task*> ListOfTask::getTasks() const{
    return tasksList;
}

string ListOfTask::toString() {
    string res = this->getName()+" : (";

    for (std::list<Task*>::iterator it = tasksList.begin(); it != tasksList.end(); ++it) {
        Task *tmpTask = *it;
        res+=tmpTask->toString();
    }
   
    return res+")";
}



int operator==(ListOfTask const &a, ListOfTask const &b) {
    if(a.getName()==b.getName()) return true;
    else return false;
}